<template>
    <div class="canvas">
        <Navbar :navtitle="title"></Navbar>
        <div id="myChart"></div>
    </div>
</template>
<script>
import Navbar from '../components/Navbar';
export default {
    components:{
        Navbar
    },
    data(){
        return{
            title:'经营分析'
        }
    },
    mounted(){
        this.drawLine()
    },
    methods:{
            drawLine(){
                // 基于准备好的dom，初始化echarts实例
                let myChart = this.$echarts.init(document.getElementById('myChart'))
                // 绘制图表
                myChart.setOption({
                    title: { text: '在Vue中使用echarts' },
                    tooltip: {},
                    xAxis: {
                        data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
                    },
                    yAxis: {},
                    series: [{
                        name: '销量',
                        type: 'bar',
                        data: [5, 20, 36, 10, 10, 20]
                    }]
                });
            },
            chart_time_btn(ind){//点击事件 更改图表数据
                console.log();
                this.dataArr=["22月","22月","32月","42月","52月","26月"]
                console.log(ind+"---");
            }
        }
}
</script>
<style>
.canvas{
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    background: #333;
    opacity: .8;
}
#myChart{
    height: 4rem;
}
</style>
